from sklearn.metrics import confusion_matrix, accuracy_score,f1_score,recall_score,precision_score
from skimage.metrics import structural_similarity as ssim
from sklearn.metrics import jaccard_similarity_score
from sklearn.metrics import precision_recall_curve,roc_auc_score,auc,roc_curve

"二分类"
# c = 0 # 表示图片的索引
# out_img = strided_crop(img_arr, mask_arr, mask_arr.shape[0], mask_arr.shape[1], 128, 128,args.stride)
# out_img[mask_arr==0] = 0
# # c表示图片的索引
# y_pred_auc[c,:,:] = out_img
# out_img[out_img>=0.5] = 1
# out_img[out_img<0.5] = 0
# y_true[c,:,:] = label_arr 
# y_pred[c,:,:] = out_img
# y_true = y_true.flatten()
# y_pred = y_pred.flatten()
# y_pred_auc = y_pred_auc.flatten()

confusion = confusion_matrix(y_true, y_pred)
tn, fp, fn, tp = confusion.ravel() 
accuracy = (tn+tp) / tn, fp, fn, tp
specificity = tn / (tn + fp)
sensitivity = tp / (tp + fn) 
precision = tp / (tp + fp) 

AUC_ROC = roc_auc_score(y_true, y_pred_auc)



